#include <iostream>
#include <memory>
#include <windows.h>
//电视类
class Television
{
public:
    virtual ~Television(){};
    virtual void play()const{};
};

class HaierTelevision:public Television
{
public:
    void play()const override{std::cout << "Haier TV..." << std::endl;};
};

class HisenseTelevision:public Television
{
public:
    void play()const override{std::cout << "海信电视播放中..." << std::endl;};
};


//空调类
class AirConditioner
{
public:
    virtual ~AirConditioner(){};
    virtual void chengeTemprature()const{};
};

class HaierAirConditioner:public AirConditioner
{
public:
     void chengeTemprature()const override{std::cout << "海尔空调调节温度中..." << std::endl;};
};

class HisenseAirConditioner:public AirConditioner
{
public:
     void chengeTemprature()const override{std::cout << "海信空调调节温度中..." << std::endl;};
};

//工厂类
class EFactory
{
public:
    virtual ~EFactory(){};
    virtual std::shared_ptr<Television> produceTelevision()const{};
    virtual std::shared_ptr<AirConditioner> produceAirConditioner()const{};
};

class HaierFactory:public EFactory
{
public:
    std::shared_ptr<Television> produceTelevision()const override
    {
        return std::make_shared<HaierTelevision>();
    };

    std::shared_ptr<AirConditioner> produceAirConditioner()const
    {
        return std::make_shared<HaierAirConditioner>();
    };
};

class HisenseFactory:public EFactory
{
public:
    std::shared_ptr<Television> produceTelevision()const override
    {
        return std::make_shared<HisenseTelevision>();
    };

    std::shared_ptr<AirConditioner> produceAirConditioner()const
    {
        return std::make_shared<HisenseAirConditioner>();
    };
};


int main(int argc, char const *argv[])
{
    SetConsoleOutputCP(CP_UTF8);
    std::shared_ptr<EFactory> factory;
    factory = std::make_shared<HisenseFactory>();
    factory->produceTelevision()->play();
    return 0;
}
